package edu.hniu.skilltest.demo06;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

import androidx.annotation.Nullable;

public class MyDBHelper extends SQLiteOpenHelper {
    private String sql = "create table T_User_infos(User_id Integer primary key autoincrement," +
            "User_email text not null,User_nickname text not null,User_pwd text not null,User_pwdagain text not null)";
    private Context mContext;

    public MyDBHelper(@Nullable Context context, int version) {
        super(context, "UserInfosDB.db", null, version);
        mContext = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //创建数据库中的表
        db.execSQL(sql);
        Toast.makeText(mContext, "数据库创建成功", Toast.LENGTH_LONG).show();
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
